/**
 * 
 */
package rs.fon.rapidminer.serialization;

import java.beans.XMLDecoder;
import java.io.FileInputStream;

/**
 * 
 * Utill class that decode from xml to process object.
 * 
 * @author Nikola Nikolic
 */
public class ProcessDecoder {

	/**
	 * 
	 * Method that decode from from xml to process object.
	 * 
	 * @param xmlFile
	 *            path to xml file
	 * @return {@link rs.fon.rapidminer.process.Process}
	 */
	public static <T> rs.fon.rapidminer.process.Process decodeFromXMLToProces(
			String xmlFile) {
		try {
			FileInputStream in = new FileInputStream(xmlFile);

			XMLDecoder xml = new XMLDecoder(in);
			rs.fon.rapidminer.process.Process process = (rs.fon.rapidminer.process.Process) xml.readObject();

			return process;

		} catch (Exception exc) {
			exc.printStackTrace();
		}

		return null;

	}

}
